#include <iostream>
float getaverage(float num[], int n);

int main()
{
    float num[10];
    for (int i = 0; i < 10; i++)
    {
        std::cout << "请输入第" << i + 1 << "个数字：" << std::endl;
        std::cin >> num[i];
    }
    std::cout << "平均温度为" << getaverage(num, 10) << std::endl;
    return 0;
}

float getaverage(float num[], int n)
{
    float max = num[0], min = num[0], sum = 0;
    
    for (int i = 0; i < n; i++)
    {
        sum += num[i];
        if (num[i] < min)
            min = num[i];
        if (num[i] > max)
            max = num[i];
    }
    sum -= max + min;

    return sum / (n - 2);
}